from Server import SocketServer
from Validator import HTTPValidator
from reptile import ReptilePool
from storage import Storage
from utils import *

# 开启日志模块
log = LogManager()
log.log("Main", "Program is running!")

# 开启爬虫模块，爬取对应数据
reptile = ReptilePool()
data = reptile.run()
http_proxy = data['http']

# 验证 HTTP 代理
http_validator = HTTPValidator()
result = http_validator.batch_check_proxy(http_proxy)

# 开启存储模块，将验证完成的代理存储到数据库中
storage = Storage()
for data in result:
	storage.add(data)

# 开启Socket服务
socket_server = SocketServer()
socket_server.run()
